package xyf.p11.other.bit;

/**
 * ClassName: M0507_Swap
 * Description:
 * Author: xyf
 * Date: 9/9/22 10:13 AM
 * Version: 1.0
 **/
public class M0507_Swap
{
    public int exchangeBits(int num)
    {
        int odd = num & 0x55555555;
        int even = num & 0xaaaaaaaa;

        odd = odd << 1;
        even = even >> 1;

        return odd | even;
    }
}
